package com.example.store.controller;

import com.example.store.common.JsonResult;
import com.example.store.entity.District;
import com.example.store.service.IDistrictService;
import com.example.store.service.impl.DistrictServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("districts")
public class DistrictController extends BaseController{

    @Autowired
    private IDistrictService districtService;
    //”/“表示处理所有传入的URI请求
    @GetMapping({"","/"})
    public JsonResult<List<District>>findByParent(String parent){
        List<District> data = districtService.findByParent(parent);
        return new JsonResult<>(OK,data);
    }
}
